<?php if (!defined('THINK_PATH')) exit(); /*a:3:{s:53:"D:\Code\lvyou/application/admin\view\banner\edit.html";i:1533522692;s:55:"D:\Code\lvyou\application\admin\view\public\header.html";i:1534833010;s:55:"D:\Code\lvyou\application\admin\view\public\footer.html";i:1532913947;}*/ ?>
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title><?php echo config('WEB_SITE_TITLE'); ?></title>
    <link href="/static/admin/css/bootstrap.min.css?v=3.3.6" rel="stylesheet">
    <link href="/static/admin/css/font-awesome.min.css?v=4.4.0" rel="stylesheet">
    <link href="/static/admin/css/animate.min.css" rel="stylesheet">
    <link href="/static/admin/css/style.min.css?v=4.1.0" rel="stylesheet">
    <link href="/static/admin/css/plugins/sweetalert/sweetalert.css" rel="stylesheet">
    <link href="/static/layui/css/layui.css" rel="stylesheet">
    <link href="/static/admin/css/admin.css" rel="stylesheet">
    <script src="/static/admin/js/jquery.min.js?v=2.1.4"></script>
    <style type="text/css">
        .long-tr th {
            text-align: center
        }

        .long-td td {
            text-align: center
        }
    </style>
</head>
<body class="gray-bg">
<div class="wrapper wrapper-content animated fadeInRight">
    <!-- Panel Other -->
    <div class="ibox float-e-margins">
        <div class="ibox-title">
            <h5>banner修改</h5>
        </div>
        <div class="ibox-content">
            <form class="layui-form" action="" method="post">
                <div class="layui-form-item">
                    <label class="layui-form-label">位置</label>
                    <div class="layui-input-block">
                        <select name="type" lay-filter="aihao">
                            <option <?php if(($data['type'] == '首页')): ?> selected <?php endif; ?> value="1" >首页</option>
                            <option <?php if(($data['type'] == '目的地')): ?> selected <?php endif; ?> value="2">目的地</option>
                            <option <?php if(($data['type'] == '攻略')): ?> selected <?php endif; ?> value="3">攻略</option>
                        </select>
                    </div>
                </div>
                <div class="layui-form-item key">
                    <label class="layui-form-label" >名称</label>
                    <div class="layui-input-block" >
                        <input value="<?php echo $data['title']; ?>" required type="text" name="title" lay-verify="title" autocomplete="off" placeholder="请输入" class="layui-input">
                    </div>
                </div>
                <div class="layui-form-item key">
                    <label class="layui-form-label" >图片</label>
                    <div class="layui-input-block" >
                        <input id="src" type="hidden" value="<?php echo $data['src']; ?>" name="src">
                        <?php if(($data['src'])): ?>
                        <img width="200px" class="img" src="<?php echo $data['src']; ?>" >
                        <?php else: ?>
                        <img width="200px" class="img" src="<?php echo $data['src']; ?>" style="display: none;">
                        <?php endif; ?>
                        <button type="button" class="layui-btn" id="test1">
                            <i class="layui-icon">&#xe67c;</i>上传图片
                        </button>
                    </div>
                </div>
                <div class="layui-form-item key">
                    <label class="layui-form-label">排序</label>
                    <div class="layui-input-block">
                        <input required value="<?php echo $data['sort']; ?>" type="number" name="sort" lay-verify="title" autocomplete="off" placeholder="请输入" class="layui-input">
                    </div>
                </div>
                <div class="layui-form-item key">
                    <label class="layui-form-label">跳转链接</label>
                    <div class="layui-input-block ee">
                        <input required value="<?php echo $data['url']; ?>" type="text" name="url" lay-verify="title" autocomplete="off" placeholder="例如：http://www.baidu.com" class="layui-input">
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">是否显示</label>
                    <div class="layui-input-block">
                        <select name="is_show" lay-filter="aihao">
                            <option <?php if(($data['is_show'] == 0)): ?> selected <?php endif; ?> value="0">不显示</option>
                            <option <?php if(($data['is_show'] == 1)): ?> selected <?php endif; ?> value="1">显示</option>
                        </select>
                    </div>
                </div>
                <div class="layui-form-item">
                    <div class="layui-input-block">
                        <input type="hidden" name="id" value="<?php echo $data['id']; ?>">
                        <input type="hidden" name="old_src" value="<?php echo $data['src']; ?>">
                        <button class="layui-btn" lay-submit="" lay-filter="demo1">立即提交</button>
                        <button type="reset" class="layui-btn layui-btn-primary">重置</button>
                    </div>
                </div>
            </form>

        </div>
    </div>
</div>
<!-- End Panel Other -->
</div>

<script src="/static/admin/js/bootstrap.min.js?v=3.3.6"></script>
<script src="/static/admin/js/lunhui.js"></script>
<script src="/static/layui/layui.all.js"></script>

<script>

    layui.use('upload', function(){
        var upload = layui.upload;

        //执行实例
        var uploadInst = upload.render({
            elem: '#test1' //绑定元素
            ,url: '/admin/upload/upload' //上传接口
            ,done: function(res){
                //上传完毕回调
                if(res.code == 200){
                    $('#src').attr('value',res.data.src);
                    $('.img').attr('src',res.data.src);
                    $('.img').css('display','');
                    layer.msg('上传成功', {icon: 1});
                }else {
                    layer.msg(res.msg, {icon: 2});
                }

            }
            ,error: function(){
                //请求异常回调
            }
        });
    });
</script>


</body>
</html>